home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 3 / Info_Mac_1994-01.iso / Development / General / GCC 1.37.1r15 / GCC.MPW / tm.h < prev    next >
Text File  |  1993-04-20  |  66KB  |  1,823 lines

  1. /* Definitions of target machine for GNU compiler.  For Macintosh MPW,
  2.    extensively modified from the generic 68k tm.h.
  3.    Copyright (C) 1987, 1988 Free Software Foundation, Inc.
  4.    Copyright (C) 1989, 1990 Apple Computer, Inc.
  5.  
  6. This file is part of GNU CC.
  7.  
  8. GNU CC is free software; you can redistribute it and/or modify
  9. it under the terms of the GNU General Public License as published by
  10. the Free Software Foundation; either version 1, or (at your option)
  11. any later version.
  12.  
  13. GNU CC is distributed in the hope that it will be useful,
  14. but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. GNU General Public License for more details.
  17.  
  18. You should have received a copy of the GNU General Public License
  19. along with GNU CC; see the file COPYING.  If not, write to
  20. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  21.  
  22. /* This comment is here to see if it will keep Sun's cpp from dying.  */
  23.  
  24. /* These actually only affect the "gcc" program in Unix, are unused in
  25.    the MPW world. */
  26.  
  27. typedef enum { noreg, pd0, pd1, pd2, pa0, pa1, k=10000} pregs;
  28.  
  29. #define MAXPARAMS 5
  30.  
  31. typedef struct parameter {
  32.     struct parameter *last;
  33.     pregs    funcreturn;
  34.     pregs    params[MAXPARAMS];
  35.     char    name[0];
  36. } parameter;
  37.  
  38. parameter *
  39. lookupparameter( const char *name );
  40. void
  41. printreg( pregs r );
  42.  
  43. #define CPP_SPEC "%{m68881:-Dmc68881}%{m68020:-Dmc68020}"
  44.  
  45. #define CC1_SPEC "%{s*}"
  46.  
  47. /* This is true when code gen can treat symbol/label refs as constants. */
  48.  
  49. #define SYMBOLS_ARE_CONSTANTS 1
  50.  
  51. /* Define this when labels/symbols have to be explicitly imported into
  52.    a module. */
  53.  
  54. #define IMPORT_NAMES
  55.  
  56. /* Define this when code labels and data labels need to be treated
  57.    differently in some way. */
  58.  
  59. #define MARK_LABEL_SECTION
  60.  
  61. /* Names to predefine in the preprocessor for this target machine.  */
  62. /* Note that this is exactly MPW's set, plus something to distinguish */
  63. /* from "regular" MPW. */
  64.  
  65. #define CPP_PREDEFINES \
  66.   "-DMC68000 -Dmc68000 -Dm68k -Dmacintosh -Dapplec -Dmpwgcc"
  67.  
  68. /* So *library call generation* uses memcpy instead of bcopy, etc. */
  69.  
  70. #define TARGET_MEM_FUNCTIONS
  71.  
  72. /* Print subsidiary information on the compiler version in use.  */
  73. #define TARGET_VERSION fprintf (stderr, " (680x0, MPW Asm syntax)");
  74.  
  75. /* Declare Mac-specific globals used in the compiler. */
  76. extern char *segment_name;
  77. extern int generate_trace_calls;
  78. extern int ignore_trace_pragmas;
  79. extern int long_double_type_size;
  80. extern int current_static_decl;
  81.  
  82. /* Should override defn in c-decl.c */
  83.  
  84. #define LONG_DOUBLE_TYPE_SIZE (long_double_type_size)
  85.  
  86. /* Run-time compilation parameters selecting different hardware subsets.  */
  87.  
  88. /* MPW compatibility means plain 68000 + SANE + Macsbug symbols. */
  89.  
  90. #define TARGET_DEFAULT 0620
  91.  
  92. extern int target_flags;
  93.  
  94. /* Macros used in the machine description to test the flags.  */
  95.  
  96. /* Compile for a 68020 (not a 68000 or 68010).   */
  97. #define TARGET_68020 (target_flags & 1)
  98. /* Compile 68881 insns for floating point (not library calls).  */
  99. #define TARGET_68881 (target_flags & 2)
  100. /* Compile using 68020 bitfield insns.  */
  101. #define TARGET_BITFIELD (target_flags & 4)
  102. /* Compile with 16-bit `int'.  */
  103. #define TARGET_SHORT (target_flags & 010)
  104. /* Include MacsBuggable symbols. */
  105. #define TARGET_MACSBUG (target_flags & 020)
  106. /* Compile transcendental fns directly to 881 stuff. */
  107. #define TARGET_ELEMS881 (target_flags & 040)
  108. /* Produce 32-bit references to global data. */
  109. #define TARGET_32BITDATA (target_flags & 0100)
  110. /* Generate code for SANE calls directly. */
  111. #define TARGET_SANE (target_flags & 0200)
  112. /* Generate code for integer library calls directly. */
  113. #define TARGET_INTLIB (target_flags & 0400)
  114. /* Generate pc-relative refs for strings after fn name. */
  115. #define TARGET_BSTR (target_flags & 01000)
  116. /* Generate obscure addressing modifications. */
  117. #define TARGET_FX30 (target_flags & 02000)
  118. /* Suppress all segment directives in the output. */
  119. #define TARGET_NOSEG (target_flags & 04000)
  120. /*  */
  121. #define TARGET_BFUN (target_flags & 010000)
  122.  
  123. /* Macro to define tables used to set the flags.
  124.    This is a list in braces of pairs in braces,
  125.    each pair being { "NAME", VALUE }
  126.    where VALUE is the bits to set or minus the bits to clear.
  127.    An empty string NAME is used to identify the default VALUE.  */
  128.  
  129. #define TARGET_SWITCHES  \
  130.   { { "68020", 5},                \
  131.     { "68000", -5},                \
  132.     { "68881", 2},                \
  133.     { "sane", 0200 },  \
  134.     { "insane", -0200 },  \
  135.     { "bitfield", 4},                \
  136.     { "nobitfield", -4},            \
  137.     { "short", 010},                \
  138.     { "noshort", -010},                \
  139.     { "bgfull", 020 }, \
  140.     { "bgoff", -020 }, \
  141.     { "elems881", 040},  \
  142.     { "m", 0100},  \
  143.     { "nointlib", -0400 },  \
  144.     { "bstr", 01000 },  \
  145.     { "fx30", 02000 },  \
  146.     { "noseg", 04000 },  \
  147.     { "bfun", 010000 },  \
  148.     { "", TARGET_DEFAULT}}
  149.  
  150. /* In the MPW world, "long double" size depends on compiler flag (yech). */
  151. /* elems881 implies m68881. */
  152. /* MPW Asm seems to require -m68020 when doing large memory model (-m). */
  153. /* One or the other of sane/mc68881 must be on, but not both. */
  154.  
  155. #define OVERRIDE_OPTIONS        \
  156. {                    \
  157.   if (TARGET_ELEMS881) target_flags |= 2;  \
  158.   long_double_type_size = (TARGET_68881 ? 96 : 80);  \
  159.   mode_size[(int) XFmode] = (TARGET_68881 ? 12 : 10);  \
  160.   mode_unit_size[(int) XFmode] = (TARGET_68881 ? 12 : 10);  \
  161.   if (TARGET_68881) target_flags &= ~0200;  \
  162.   if (TARGET_SANE) target_flags &= ~2;  \
  163.   if (TARGET_32BITDATA) target_flags |= 5;  \
  164. }
  165.  
  166. /* target machine storage layout */
  167.  
  168. /* Define this if most significant bit is lowest numbered
  169.    in instructions that operate on numbered bit-fields.
  170.    This is true for 68020 insns such as bfins and bfexts.
  171.    We make it true always by avoiding using the single-bit insns
  172.    except in special cases with constant bit numbers.  */
  173. #define BITS_BIG_ENDIAN
  174.  
  175. /* Define this if most significant byte of a word is the lowest numbered.  */
  176. /* That is true on the 68000.  */
  177. #define BYTES_BIG_ENDIAN
  178.  
  179. /* Define this if most significant word of a multiword number is numbered.  */
  180. /* For 68000 we can decide arbitrarily
  181.    since there are no machine instructions for them.  */
  182. /* #define WORDS_BIG_ENDIAN */
  183.  
  184. /* number of bits in an addressible storage unit */
  185. #define BITS_PER_UNIT 8
  186.  
  187. /* Width in bits of a "word", which is the contents of a machine register.
  188.    Note that this is not necessarily the width of data type `int';
  189.    if using 16-bit ints on a 68000, this would still be 32.
  190.    But on a machine with 16-bit registers, this would be 16.  */
  191. #define BITS_PER_WORD 32
  192.  
  193. /* Width of a word, in units (bytes).  */
  194. #define UNITS_PER_WORD 4
  195.  
  196. /* Width in bits of a pointer.
  197.    See also the macro `Pmode' defined below.  */
  198. #define POINTER_SIZE 32
  199.  
  200. /* Allocation boundary (in *bits*) for storing pointers in memory.  */
  201. #define POINTER_BOUNDARY 16
  202.  
  203. /* Allocation boundary (in *bits*) for storing arguments in argument list.  */
  204. /* Note that prototype promotion will do traditional alignment if necessary,
  205.    but pascal fns will still need padding. */
  206. #define PARM_BOUNDARY 16
  207.  
  208. /* Boundary (in *bits*) on which stack pointer should be aligned.  */
  209. #define STACK_BOUNDARY 16
  210.  
  211. /* Allocation boundary (in *bits*) for the code of a function.  */
  212. #define FUNCTION_BOUNDARY 16
  213.  
  214. /* Alignment of field after `int : 0' in a structure.  */
  215. #define EMPTY_FIELD_BOUNDARY 16
  216.  
  217. /* Every structure or union's size must be a multiple of 2 bytes.  */
  218. #define STRUCTURE_SIZE_BOUNDARY 16
  219.  
  220. /* No data type wants to be aligned rounder than this.  */
  221. #define BIGGEST_ALIGNMENT 16
  222.  
  223. /* Define this if move instructions will actually fail to work
  224.    when given unaligned data.  */
  225. #define STRICT_ALIGNMENT
  226.  
  227. /* Define number of bits in most basic integer type.
  228.    (If undefined, default is BITS_PER_WORD).  */
  229.  
  230. #define INT_TYPE_SIZE (TARGET_SHORT ? 16 : 32)
  231.  
  232. /* Define the largest mode that can be treated as a regular integer. */
  233.  
  234. /* MPW C tends to think of larger things as block mode objects, so we
  235.    should do this to maintain cross-callability. */
  236. #define MAX_FIXED_MODE_SIZE (GET_MODE_BITSIZE (SImode))
  237.  
  238. /* Standard register usage.  */
  239.  
  240. /* Number of actual hardware registers.
  241.    The hardware registers are assigned numbers for the compiler
  242.    from 0 to just below FIRST_PSEUDO_REGISTER.
  243.    All registers that the compiler knows about must be given numbers,
  244.    even those that are not normally considered general registers.
  245.    For the 68000, we give the data registers numbers 0-7,
  246.    the address registers numbers 010-017,
  247.    and the 68881 floating point registers numbers 020-027.  */
  248. #define FIRST_PSEUDO_REGISTER 24
  249.  
  250. /* 1 for registers that have pervasive standard uses
  251.    and are not available for the register allocator.
  252.    On the 68000, only the stack pointer is such, but A5 is special to Macs. */
  253. #define FIXED_REGISTERS  \
  254.  {0, 0, 0, 0, 0, 0, 0, 0, \
  255.   0, 0, 0, 0, 0, 1, 1, 1, \
  256.   0, 0, 0, 0, 0, 0, 0, 0, }
  257.  
  258. /* 1 for registers not available across function calls.
  259.    These must include the FIXED_REGISTERS and also any
  260.    registers that can be used without being saved.
  261.    The latter must include the registers where values are returned
  262.    and the register where structure-value addresses are passed.
  263.    Aside from that, you can include as many other registers as you like.  */
  264. /* This includes all of MPW's scratch registers. */
  265. #define CALL_USED_REGISTERS \
  266.  {1, 1, 1, 0, 0, 0, 0, 0, \
  267.   1, 1, 0, 0, 0, 1, 1, 1, \
  268.   1, 1, 1, 1, 0, 0, 0, 0, }
  269.  
  270. /* Make sure everything's fine if we *don't* have a given processor.
  271.    This assumes that putting a register in fixed_regs will keep the
  272.    compilers mitt's completely off it.  We don't bother to zero it out
  273.    of register classes.  If TARGET_68881 is not set,
  274.    the compiler won't touch since no instructions that use these
  275.    registers will be valid.  */
  276. #define CONDITIONAL_REGISTER_USAGE \
  277. {                         \
  278.   int i;                     \
  279.   HARD_REG_SET x;                 \
  280.     {                         \
  281.       COPY_HARD_REG_SET (x, reg_class_contents[(int)NO_REGS]); \
  282.       for (i = 0; i < FIRST_PSEUDO_REGISTER; i++ ) \
  283.        if (TEST_HARD_REG_BIT (x, i))         \
  284.     fixed_regs[i] = call_used_regs[i] = 1;     \
  285.     }                         \
  286. }
  287.  
  288. /* Return number of consecutive hard regs needed starting at reg REGNO
  289.    to hold something of mode MODE.
  290.    This is ordinarily the length in words of a value of mode MODE
  291.    but can be less for certain modes in special long registers.
  292.  
  293.    On the 68000, ordinary registers hold 32 bits worth;
  294.    for the 68881 registers, a single register is always enough for
  295.    anything that can be stored in them at all.  */
  296. #define HARD_REGNO_NREGS(REGNO, MODE)   \
  297.   ((REGNO) >= 16 ? 1                \
  298.    : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
  299.  
  300. /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
  301.    On the 68000, the cpu registers can hold any mode but the 68881 registers
  302.    can hold only float modes.  And the 68881 registers can't hold anything
  303.    if 68881 use is disabled.  Actually, we have to exclude d6 and/or d7 if
  304.    we're using 2 or 3 registers to hold a value, since the "next" register(s)
  305.    would be a0/a1, and things would get really confusing. */
  306. #define HARD_REGNO_MODE_OK(REGNO, MODE) \
  307.   (((REGNO) < 16 &&  \
  308.     ! (GET_MODE_SIZE (MODE) > 4 && (REGNO) >= 6) &&  \
  309.     ! (GET_MODE_SIZE (MODE) > 8 && (REGNO) >= 6))  \
  310.    || (TARGET_68881 && GET_MODE_CLASS (MODE) == MODE_FLOAT))
  311.  
  312. /* Value is 1 if it is a good idea to tie two pseudo registers
  313.    when one has mode MODE1 and one has mode MODE2.
  314.    If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
  315.    for any hard reg, then this must be 0 for correct output.
  316.  
  317.    Going by the above defn, we can tie modes for general regs (what about
  318.    d6/d7 tho?) and equal modes for float regs. */
  319. #define MODES_TIEABLE_P(MODE1, MODE2)            \
  320.    (TARGET_68881    ?                \
  321.    ((GET_MODE_CLASS (MODE1) == MODE_FLOAT)           \
  322.        == (GET_MODE_CLASS (MODE2) == MODE_FLOAT)) :  \
  323.    ((GET_MODE_SIZE (MODE1) < 8) && (GET_MODE_SIZE (MODE2) < 8)))
  324.  
  325. /* Specify the registers used for certain standard purposes.
  326.    The values of these macros are register numbers.  */
  327.  
  328. /* m68000 pc isn't overloaded on a register.  */
  329. /* #define PC_REGNUM  */
  330.  
  331. /* Register to use for pushing function arguments.  */
  332. #define STACK_POINTER_REGNUM 15
  333.  
  334. /* Base register for access to local variables of the function.  */
  335. #define FRAME_POINTER_REGNUM 14
  336.  
  337. /* Value should be nonzero if functions must have frame pointers.
  338.    Zero means the frame pointer need not be set up (and parms
  339.    may be accessed via the stack pointer) in functions that seem suitable.
  340.    This is computed in `reload', in reload1.c.  */
  341. #define FRAME_POINTER_REQUIRED 0
  342.  
  343. /* Base register for access to arguments of the function.  */
  344. #define ARG_POINTER_REGNUM 14
  345.  
  346. /* Register in which static-chain is passed to a function.  */
  347. #define STATIC_CHAIN_REGNUM 8
  348.  
  349. /* Register in which address to store a structure value
  350.    arrives in the function.
  351.  
  352.    The MPW 3.0 calling convention is to have things on the stack top.  */
  353. #define STRUCT_VALUE_INCOMING    \
  354.    gen_rtx (MEM, Pmode, gen_rtx (PLUS, Pmode, frame_pointer_rtx,    \
  355.                  gen_rtx (CONST_INT, VOIDmode, 8)))
  356.  
  357. /* Place in which caller passes the structure value address.
  358.    Actually, all that matters about this value is it its rtx_code:
  359.    MEM means push the value on the stack like an argument.  */
  360. #define STRUCT_VALUE  \
  361.    gen_rtx (MEM, Pmode, gen_rtx (PRE_DEC, Pmode, stack_pointer_rtx))
  362.  
  363. /* To be MPW-compatible, multi-word structures cannot live in regs. */
  364.  
  365. #define RETURN_IN_MEMORY(TYPE) \
  366.   ((TREE_CODE (TYPE) == RECORD_TYPE || TREE_CODE (TYPE) == UNION_TYPE) && \
  367.    (GET_MODE_SIZE (TYPE_MODE (TYPE)) > UNITS_PER_WORD))
  368.  
  369. /* Pad shorts and chars upwards, but nobody else. */
  370.  
  371. #define FUNCTION_ARG_PADDING(MODE,SIZE)  \
  372.     (((MODE) == BLKmode                            \
  373.     ? (GET_CODE (SIZE) == CONST_INT                    \
  374.        && INTVAL (SIZE) < PARM_BOUNDARY / BITS_PER_UNIT)        \
  375.     : GET_MODE_BITSIZE (MODE) < PARM_BOUNDARY)                \
  376.    ? upward : none)
  377.  
  378.  
  379. /* Define the classes of registers for register constraints in the
  380.    machine description.  Also define ranges of constants.
  381.  
  382.    One of the classes must always be named ALL_REGS and include all hard regs.
  383.    If there is more than one class, another class must be named NO_REGS
  384.    and contain no registers.
  385.  
  386.    The name GENERAL_REGS must be the name of a class (or an alias for
  387.    another name such as ALL_REGS).  This is the class of registers
  388.    that is allowed by "g" or "r" in a register constraint.
  389.    Also, registers outside this class are allocated only when
  390.    instructions express preferences for them.
  391.  
  392.    The classes must be numbered in nondecreasing order; that is,
  393.    a larger-numbered class must never be contained completely
  394.    in a smaller-numbered class.
  395.  
  396.    For any two classes, it is very desirable that there be another
  397.    class that represents their union.  */
  398.  
  399. /* The 68000 has three kinds of registers, so eight classes would be
  400.    a complete set.  One of them (addr_or_fp) is not needed.  */
  401.  
  402. enum reg_class {
  403.   NO_REGS, FP_REGS,
  404.   DATA_REGS, DATA_OR_FP_REGS,
  405.   ADDR_REGS, GENERAL_REGS,
  406.   ALL_REGS,
  407.   LIM_REG_CLASSES
  408. #ifdef MPW_C31
  409.   , reg_class_intifier = 1000000
  410. #endif /* MPW_C31 */
  411. };
  412.  
  413. #define N_REG_CLASSES (int) LIM_REG_CLASSES
  414.  
  415. /* Give names of register classes as strings for dump file.   */
  416.  
  417. #define REG_CLASS_NAMES \
  418.  { "NO_REGS", "FP_REGS",  \
  419.    "DATA_REGS", "DATA_OR_FP_REGS",  \
  420.    "ADDR_REGS", "GENERAL_REGS",  \
  421.    "ALL_REGS" }
  422.  
  423. /* Define which registers fit in which classes.
  424.    This is an initializer for a vector of HARD_REG_SET
  425.    of length N_REG_CLASSES.  */
  426.  
  427. #define REG_CLASS_CONTENTS \
  428. {                    \
  429.  0,        /* NO_REGS */        \
  430.  0xff0000,    /* FP_REGS */        \
  431.  0x0000ff,    /* DATA_REGS */        \
  432.  0xff00ff,    /* DATA_OR_FP_REGS */    \
  433.  0x00ff00,    /* ADDR_REGS */        \
  434.  0x00ffff,    /* GENERAL_REGS */    \
  435.  0xffffff,    /* ALL_REGS */        \
  436. }
  437.  
  438. /* The same information, inverted:
  439.    Return the class number of the smallest class containing
  440.    reg number REGNO.  This could be a conditional expression
  441.    or could index an array.  */
  442.  
  443. extern enum reg_class regno_reg_class[];
  444. #define REGNO_REG_CLASS(REGNO) (regno_reg_class[(REGNO)>>3])
  445.  
  446. /* The class value for index registers, and the one for base regs.  */
  447.  
  448. #define INDEX_REG_CLASS GENERAL_REGS
  449. #define BASE_REG_CLASS ADDR_REGS
  450.  
  451. /* Get reg_class from a letter such as appears in the machine description.
  452.    We do a trick here to modify the effective constraints on the
  453.    machine description; we zorch the constraint letters that aren't
  454.    appropriate for a specific target.  This allows us to guarrantee
  455.    that a specific kind of register will not be used for a given taget
  456.    without fiddling with the register classes above. */
  457.  
  458. #define REG_CLASS_FROM_LETTER(C) \
  459.   ((C) == 'a' ? ADDR_REGS :            \
  460.    ((C) == 'd' ? DATA_REGS :            \
  461.     ((C) == 'f' ? (TARGET_68881 ? FP_REGS : NO_REGS) :  \
  462.      NO_REGS)))
  463.  
  464. /* The letters I, J, K, L and M in a register constraint string
  465.    can be used to stand for particular ranges of immediate operands.
  466.    This macro defines what the ranges are.
  467.    C is the letter, and VALUE is a constant value.
  468.    Return 1 if VALUE is in the range specified by C.
  469.  
  470.    For the 68000, `I' is used for the range 1 to 8
  471.    allowed as immediate shift counts and in addq.
  472.    `J' is used for the range of signed numbers that fit in 16 bits.
  473.    `K' is for numbers that moveq can't handle.
  474.    `L' is for range -8 to -1, range of values that can be added with subq.  */
  475.  
  476. #define CONST_OK_FOR_LETTER_P(VALUE, C)  \
  477.   ((C) == 'I' ? (VALUE) > 0 && (VALUE) <= 8 :    \
  478.    (C) == 'J' ? (VALUE) >= -0x8000 && (VALUE) <= 0x7FFF :    \
  479.    (C) == 'K' ? (VALUE) < -0x80 || (VALUE) >= 0x80 :    \
  480.    (C) == 'L' ? (VALUE) < 0 && (VALUE) >= -8 :  \
  481.    (C) == 'M' ? 1 : 0)
  482.  
  483. /*
  484.  * A small bit of explanation:
  485.  * "G" defines all of the floating constants that are *NOT* 68881
  486.  * constants.  this is so 68881 constants get reloaded and the
  487.  * fpmovecr is used.
  488.  */
  489. #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C)  \
  490.   ((C) == 'G' ? ! (TARGET_68881 && standard_68881_constant_p (VALUE)) : 0)
  491.  
  492. /* Given an rtx X being reloaded into a reg required to be
  493.    in class CLASS, return the class of reg to actually use.
  494.    In general this is just CLASS; but on some machines
  495.    in some cases it is preferable to use a more restrictive class.
  496.    On the 68000 series, use a data reg if possible when the
  497.    value is a constant in the range where moveq could be used
  498.    and we ensure that QImodes are reloaded into data regs.  */
  499. #define PREFERRED_RELOAD_CLASS(X,CLASS)  \
  500.   ((GET_CODE (X) == CONST_INT            \
  501.     && (unsigned) (INTVAL (X) + 0x80) < 0x100    \
  502.     && (CLASS) != ADDR_REGS)            \
  503.    ? DATA_REGS                    \
  504.    : GET_MODE (X) == QImode            \
  505.    ? DATA_REGS                    \
  506.    : (CLASS))
  507.  
  508. /* Return the maximum number of consecutive registers
  509.    needed to represent mode MODE in a register of class CLASS.  */
  510. /* On the 68000, this is the size of MODE in words,
  511.    except in the FP regs, where a single reg is always enough.  */
  512. #define CLASS_MAX_NREGS(CLASS, MODE)    \
  513.  ((CLASS) == FP_REGS ? 1 \
  514.   : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
  515.  
  516. /* Stack layout; function entry, exit and calling.  */
  517.  
  518. /* Define this if pushing a word on the stack
  519.    makes the stack pointer a smaller address.  */
  520. #define STACK_GROWS_DOWNWARD
  521.  
  522. /* Define this if the nominal address of the stack frame
  523.    is at the high-address end of the local variables;
  524.    that is, each additional local variable allocated
  525.    goes at a more negative offset in the frame.  */
  526. #define FRAME_GROWS_DOWNWARD
  527.  
  528. /* Offset within stack frame to start allocating local variables at.
  529.    If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
  530.    first local allocated.  Otherwise, it is the offset to the BEGINNING
  531.    of the first local allocated.  */
  532. #define STARTING_FRAME_OFFSET 0
  533.  
  534. /* If we generate an insn to push BYTES bytes,
  535.    this says how many the stack pointer really advances by.
  536.    On the 68000, sp@- in a byte insn really pushes a word.  */
  537. #define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & ~1)
  538.  
  539. /* Offset of first parameter from the argument pointer register value.  */
  540. #define FIRST_PARM_OFFSET(FNDECL) 8
  541.  
  542. /* Value is 1 if returning from a function call automatically
  543.    pops the arguments described by the number-of-args field in the call.
  544.    FUNTYPE is the data type of the function (as a tree),
  545.    or for a library call it is an identifier node for the subroutine name.
  546.  
  547.    Always false on the Mac, even for pascal fns (really?). */
  548.  
  549. #define RETURN_POPS_ARGS(FUNTYPE) 0
  550.  
  551. /* Define how to find the value returned by a function.
  552.    VALTYPE is the data type of the value (as a tree).
  553.    If the precise function being called is known, FUNC is its FUNCTION_DECL;
  554.    otherwise, FUNC is 0.  */
  555.  
  556. /* On the Mac the return value is in D0 except for pascal routines, but
  557.    pascal fakes this, since space has to be reserved ahead of time, which
  558.    needs mods in the code proper. */
  559. /* 68881 functions return floats in FP0. */
  560.  
  561. #define FUNCTION_VALUE(VALTYPE, FUNC)  \
  562.     function_value( VALTYPE, FUNC )
  563.  
  564. #if 0
  565.   gen_rtx (REG, TYPE_MODE (VALTYPE),  \
  566.        (TARGET_68881 &&  \
  567.         (GET_MODE_CLASS (TYPE_MODE (VALTYPE)) == MODE_FLOAT) ?  \
  568.         16 : 0))
  569. #endif
  570.  
  571. /* The actual offset gets filled after assign_parms is run... */
  572.  
  573. #define FUNCTION_OUTGOING_VALUE(VALTYPE, FUNC) \
  574.     function_outgoing_value( VALTYPE, FUNC )
  575.  
  576. #if 0
  577.   (((FUNC) && current_function_is_pascal) ?  \
  578.    gen_rtx (MEM, TYPE_MODE (VALTYPE),  \
  579.             gen_rtx (PLUS, Pmode,  \
  580.              frame_pointer_rtx,  \
  581.              gen_rtx (CONST_INT, VOIDmode, 12345))) :  \
  582.    FUNCTION_VALUE (VALTYPE, FUNC))
  583. #endif
  584.  
  585. /* Define how to find the value returned by a library function
  586.    assuming the value has mode MODE.  */
  587.  
  588. /* If we ever have any lib routines, they'll probably return in D0. */
  589.  
  590. #define LIBCALL_VALUE(MODE)  gen_rtx (REG, MODE, 0)
  591.  
  592. /* 1 if N is a possible register number for a function value.
  593. /* This is d0 or fp0. */
  594.  
  595. #define FUNCTION_VALUE_REGNO_P(N)  \
  596.   ((N) == 0 || (TARGET_68881 && (N) == 16))
  597.  
  598. /* Define this if PCC uses the nonreentrant convention for returning
  599.    structure and union values.  */
  600. /* MPW doesn't know diddly-squat about PCC. */
  601.  
  602. #undef PCC_STATIC_STRUCT_RETURN
  603.  
  604. /* 1 if N is a possible register number for function argument passing.
  605.    On the 68000, no registers are used in this way.  */
  606.  
  607. #define FUNCTION_ARG_REGNO_P(N) 0
  608.  
  609. /* Define a data type for recording info about an argument list
  610.    during the scan of that argument list.  This data type should
  611.    hold all necessary information about the function itself
  612.    and about the args processed so far, enough to enable macros
  613.    such as FUNCTION_ARG to determine where the next arg should go.
  614.  
  615.    On the m68k, this is a single integer, which is a number of bytes
  616.    of arguments scanned so far.  */
  617.  
  618. typedef struct {
  619.     int size;
  620.     int count;
  621.     parameter *p;
  622. } paramlist;
  623.  
  624. #define CUMULATIVE_ARGS paramlist
  625.  
  626. /* Initialize a variable CUM of type CUMULATIVE_ARGS
  627.    for a call to a function whose data type is FNTYPE.
  628.    For a library call, FNTYPE is 0.
  629.  
  630.    On the m68k, the offset starts at 0.  */
  631.  
  632. #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,PARA)    \
  633.  ((CUM).size = 0, (CUM).count = 0, (CUM).p=(PARA) )
  634.  
  635. /* Update the data in CUM to advance over an argument
  636.    of mode MODE and data type TYPE.
  637.    (TYPE is null for libcalls where that information may not be available.)  */
  638.  
  639. #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED)    \
  640.  ((CUM).size += ((MODE) != BLKmode            \
  641.         ? (GET_MODE_SIZE (MODE) + 3) & ~3    \
  642.         : (int_size_in_bytes (TYPE) + 3) & ~3),\
  643.   (CUM).count +=1 )
  644.  
  645. /* Define where to put the arguments to a function.
  646.    Value is zero to push the argument on the stack,
  647.    or a hard register in which to store the argument.
  648.  
  649.    MODE is the argument's machine mode.
  650.    TYPE is the data type of the argument (as a tree).
  651.     This is null for libcalls where that information may
  652.     not be available.
  653.    CUM is a variable of type CUMULATIVE_ARGS which gives info about
  654.     the preceding args and about the function being called.
  655.    NAMED is nonzero if this argument is a named parameter
  656.     (otherwise it is an extra parameter matching an ellipsis).  */
  657.  
  658. /* On the 68000 all args are pushed. */
  659.  
  660. #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) function_arg( &CUM, MODE, NAMED )
  661.  
  662. /* For an arg passed partly in registers and partly in memory,
  663.    this is the number of registers used.
  664.    For args passed entirely in registers or entirely in memory, zero.  */
  665.  
  666. #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) 0
  667.  
  668. /* This macro generates the assembly code for function entry.
  669.    FILE is a stdio stream to output the code to.
  670.    SIZE is an int: how many units of temporary storage to allocate.
  671.    Refer to the array `regs_ever_live' to determine which registers
  672.    to save; `regs_ever_live[I]' is nonzero if register number I
  673.    is ever used in the function.  This macro is responsible for
  674.    knowing which registers should not be saved even if used.  */
  675.  
  676. /* The ugliness here is thanks to the MPW assembler, which insists
  677.    on dn/an register masks. */
  678.  
  679. #define FUNCTION_PROLOGUE(FILE, SIZE)  function_prologue (FILE, SIZE)
  680.  
  681. /* Output assembler code to FILE to increment profiler label # LABELNO
  682.    for profiling a function entry.  */
  683.  
  684. #define FUNCTION_PROFILER(FILE, LABELNO)  \
  685.   fprintf (FILE, "\tlea LP%d,a0\n\tjsr fn##count\n", LABELNO)
  686.  
  687. /* Output assembler code to FILE to initialize this source file's
  688.    basic block profiling info, if that has not already been done.  */
  689.  
  690. #define FUNCTION_BLOCK_PROFILER(FILE, LABELNO)  \
  691.   fprintf (FILE, "\ttst.l LPBX0\n\tbne LPI%d\n", LABELNO);  \
  692.   fprintf (FILE, "\tpea LPBX0\n\tjsr bb##init\n\taddq.l #4,sp\n");  \
  693.   fprintf (FILE, "LPI%d:\n", LABELNO);
  694.  
  695. /* Output assembler code to FILE to increment the entry-count for
  696.    the BLOCKNO'th basic block in this source file.  */
  697.  
  698. #define BLOCK_PROFILER(FILE, BLOCKNO)    \
  699.   fprintf (FILE, "\taddq.l #1,LPBX2+%d\n", 4 * BLOCKNO)
  700.  
  701. /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
  702.    the stack pointer does not matter.  The value is tested only in
  703.    functions that have frame pointers.
  704.    No definition is equivalent to always zero.  */
  705.  
  706. #define EXIT_IGNORE_STACK 1
  707.  
  708. /* This macro generates the assembly code for function exit,
  709.    on machines that need it.  If FUNCTION_EPILOGUE is not defined
  710.    then individual return instructions are generated for each
  711.    return statement.  Args are same as for FUNCTION_PROLOGUE.
  712.  
  713.    The function epilogue should not depend on the current stack pointer!
  714.    It should use the frame pointer only.  This is mandatory because
  715.    of alloca; we also take advantage of it to omit stack adjustments
  716.    before returning.  */
  717.  
  718. #define FUNCTION_EPILOGUE(FILE, SIZE) function_epilogue (FILE, SIZE)
  719.  
  720. /* If the memory address ADDR is relative to the frame pointer,
  721.    correct it to be relative to the stack pointer instead.
  722.    This is for when we don't use a frame pointer.
  723.    ADDR should be a variable name.  */
  724.  
  725. #define FIX_FRAME_POINTER_ADDRESS(ADDR,DEPTH)  \
  726. { int offset = -1;                            \
  727.   rtx regs = stack_pointer_rtx;                        \
  728.   if (ADDR == frame_pointer_rtx)                    \
  729.     offset = 0;                                \
  730.   else if (GET_CODE (ADDR) == PLUS && XEXP (ADDR, 0) == frame_pointer_rtx \
  731.        && GET_CODE (XEXP (ADDR, 1)) == CONST_INT)            \
  732.     offset = INTVAL (XEXP (ADDR, 1));                    \
  733.   else if (GET_CODE (ADDR) == PLUS && XEXP (ADDR, 0) == frame_pointer_rtx) \
  734.     { rtx other_reg = XEXP (ADDR, 1);                    \
  735.       offset = 0;                            \
  736.       regs = gen_rtx (PLUS, Pmode, stack_pointer_rtx, other_reg); }    \
  737.   else if (GET_CODE (ADDR) == PLUS && XEXP (ADDR, 1) == frame_pointer_rtx) \
  738.     { rtx other_reg = XEXP (ADDR, 0);                    \
  739.       offset = 0;                            \
  740.       regs = gen_rtx (PLUS, Pmode, stack_pointer_rtx, other_reg); }    \
  741.   else if (GET_CODE (ADDR) == PLUS                    \
  742.        && GET_CODE (XEXP (ADDR, 0)) == PLUS                \
  743.        && XEXP (XEXP (ADDR, 0), 0) == frame_pointer_rtx        \
  744.        && GET_CODE (XEXP (ADDR, 1)) == CONST_INT)            \
  745.     { rtx other_reg = XEXP (XEXP (ADDR, 0), 1);                \
  746.       offset = INTVAL (XEXP (ADDR, 1));                    \
  747.       regs = gen_rtx (PLUS, Pmode, stack_pointer_rtx, other_reg); }    \
  748.   else if (GET_CODE (ADDR) == PLUS                    \
  749.        && GET_CODE (XEXP (ADDR, 0)) == PLUS                \
  750.        && XEXP (XEXP (ADDR, 0), 1) == frame_pointer_rtx        \
  751.        && GET_CODE (XEXP (ADDR, 1)) == CONST_INT)            \
  752.     { rtx other_reg = XEXP (XEXP (ADDR, 0), 0);                \
  753.       offset = INTVAL (XEXP (ADDR, 1));                    \
  754.       regs = gen_rtx (PLUS, Pmode, stack_pointer_rtx, other_reg); }    \
  755.   if (offset >= 0)                            \
  756.     { int regno;                            \
  757.       extern char call_used_regs[];                    \
  758.       for (regno = 16; regno < FIRST_PSEUDO_REGISTER; regno++)        \
  759.         if (regs_ever_live[regno] && ! call_used_regs[regno])        \
  760.           offset += 12;                            \
  761.       for (regno = 0; regno < 16; regno++)                \
  762.     if (regs_ever_live[regno] && ! call_used_regs[regno])        \
  763.       offset += 4;                            \
  764.       offset -= 4;                            \
  765.       ADDR = plus_constant (regs, offset + (DEPTH)); } }        \
  766.  
  767. /* Disable function cse even though it's good, because this screws up
  768.    direct functions and I'm too lazy to put in the exact test everywhere. */
  769.  
  770. #define NO_FUNCTION_CSE
  771.  
  772.  
  773. /* Addressing modes, and classification of registers for them.  */
  774.  
  775. #define HAVE_POST_INCREMENT
  776.  
  777. #define HAVE_PRE_DECREMENT
  778.  
  779. /* Macros to check register numbers against specific register classes.  */
  780.  
  781. /* These assume that REGNO is a hard or pseudo reg number.
  782.    They give nonzero only if REGNO is a hard reg of the suitable class
  783.    or a pseudo reg currently allocated to a suitable hard reg.
  784.    Since they use reg_renumber, they are safe only once reg_renumber
  785.    has been allocated, which happens in local-alloc.c.  */
  786.  
  787. #define REGNO_OK_FOR_INDEX_P(REGNO) \
  788. ((REGNO) < 16 || (unsigned) reg_renumber[REGNO] < 16)
  789. #define REGNO_OK_FOR_BASE_P(REGNO) \
  790. (((REGNO) ^ 010) < 8 || (unsigned) (reg_renumber[REGNO] ^ 010) < 8)
  791. #define REGNO_OK_FOR_DATA_P(REGNO) \
  792. ((REGNO) < 8 || (unsigned) reg_renumber[REGNO] < 8)
  793. #define REGNO_OK_FOR_FP_P(REGNO) \
  794. (((REGNO) ^ 020) < 8 || (unsigned) (reg_renumber[REGNO] ^ 020) < 8)
  795.  
  796. /* Now macros that check whether X is a register and also,
  797.    strictly, whether it is in a specified class.
  798.  
  799.    These macros are specific to the 68000, and may be used only
  800.    in code for printing assembler insns and in conditions for
  801.    define_optimization.  */
  802.  
  803. /* 1 if X is a data register.  */
  804.  
  805. #define DATA_REG_P(X) (REG_P (X) && REGNO_OK_FOR_DATA_P (REGNO (X)))
  806.  
  807. /* 1 if X is an fp register.  */
  808.  
  809. #define FP_REG_P(X) (REG_P (X) && REGNO_OK_FOR_FP_P (REGNO (X)))
  810.  
  811. /* 1 if X is an address register  */
  812.  
  813. #define ADDRESS_REG_P(X) (REG_P (X) && REGNO_OK_FOR_BASE_P (REGNO (X)))
  814.  
  815.  
  816. /* Maximum number of registers that can appear in a valid memory address.  */
  817.  
  818. #define MAX_REGS_PER_ADDRESS 2
  819.  
  820. /* Recognize any constant value that is a valid address.  */
  821.  
  822. #define CONSTANT_ADDRESS_P(X)  \
  823.   (GET_CODE (X) == LABEL_REF  /* || GET_CODE (X) == SYMBOL_REF  */    \
  824.    || GET_CODE (X) == CONST_INT                        \
  825.    || GET_CODE (X) == CONST)
  826.  
  827. /*  CONSTANT_P (X)  */
  828.  
  829. /* Nonzero if the constant value X is a legitimate general operand.
  830.    It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE.  */
  831.  
  832. #define LEGITIMATE_CONSTANT_P(X) 1
  833.  
  834. /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
  835.    and check its validity for a certain class.
  836.    We have two alternate definitions for each of them.
  837.    The usual definition accepts all pseudo regs; the other rejects
  838.    them unless they have been allocated suitable hard regs.
  839.    The symbol REG_OK_STRICT causes the latter definition to be used.
  840.  
  841.    Most source files want to accept pseudo regs in the hope that
  842.    they will get allocated to the class that the insn wants them to be in.
  843.    Source files for reload pass need to be strict.
  844.    After reload, it makes no difference, since pseudo regs have
  845.    been eliminated by then.  */
  846.  
  847. #ifndef REG_OK_STRICT
  848.  
  849. /* Nonzero if X is a hard reg that can be used as an index
  850.    or if it is a pseudo reg.  */
  851. #define REG_OK_FOR_INDEX_P(X) ((REGNO (X) ^ 020) >= 8)
  852. /* Nonzero if X is a hard reg that can be used as a base reg
  853.    or if it is a pseudo reg.  */
  854. #define REG_OK_FOR_BASE_P(X) ((REGNO (X) & ~027) != 0)
  855.  
  856. #else
  857.  
  858. /* Nonzero if X is a hard reg that can be used as an index.  */
  859. #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
  860. /* Nonzero if X is a hard reg that can be used as a base reg.  */
  861. #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
  862.  
  863. #endif
  864.  
  865. /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
  866.    that is a valid memory address for an instruction.
  867.    The MODE argument is the machine mode for the MEM expression
  868.    that wants to use this address.
  869.  
  870.    The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS.  */
  871.  
  872. #define GO_IF_INDEXING(X, ADDR)    \
  873. { if (GET_CODE (X) == PLUS && LEGITIMATE_INDEX_P (XEXP (X, 0)))        \
  874.    { if (GET_CODE (XEXP (X, 1)) == LABEL_REF) goto ADDR;        \
  875.      if (GET_CODE (XEXP (X, 1)) == REG && REG_OK_FOR_BASE_P (XEXP (X, 1)))  \
  876.        goto ADDR; }  \
  877.   if (GET_CODE (X) == PLUS && LEGITIMATE_INDEX_P (XEXP (X, 1)))        \
  878.    { if (GET_CODE (XEXP (X, 0)) == LABEL_REF) goto ADDR;        \
  879.      if (GET_CODE (XEXP (X, 0)) == REG && REG_OK_FOR_BASE_P (XEXP (X, 0)))  \
  880.        goto ADDR; } }
  881.  
  882. #ifdef MPW_C
  883.  
  884. /* MPW C runs out of space compiling large macros, so use simplified forms. */
  885.  
  886. #define LEGITIMATE_INDEX_REG_P(X)   \
  887.   ((GET_CODE (X) == REG && REG_OK_FOR_INDEX_P (X)))
  888.  
  889. #define LEGITIMATE_INDEX_P(X)   \
  890.    (LEGITIMATE_INDEX_REG_P (X))
  891.  
  892. #else
  893.  
  894. #define LEGITIMATE_INDEX_REG_P(X)   \
  895.   ((GET_CODE (X) == REG && REG_OK_FOR_INDEX_P (X))      \
  896.    || (GET_CODE (X) == SIGN_EXTEND            \
  897.        && GET_CODE (XEXP (X, 0)) == REG            \
  898.        && GET_MODE (XEXP (X, 0)) == HImode        \
  899.        && REG_OK_FOR_INDEX_P (XEXP (X, 0))))
  900.  
  901. #define LEGITIMATE_INDEX_P(X)   \
  902.    (LEGITIMATE_INDEX_REG_P (X)  \
  903.     || (TARGET_68020 && GET_CODE (X) == MULT        \
  904.     && LEGITIMATE_INDEX_REG_P (XEXP (X, 0))        \
  905.     && GET_CODE (XEXP (X, 1)) == CONST_INT        \
  906.     && (INTVAL (XEXP (X, 1)) == 2            \
  907.         || INTVAL (XEXP (X, 1)) == 4        \
  908.         || INTVAL (XEXP (X, 1)) == 8)))
  909.  
  910. #endif /* MPW_C */
  911.  
  912. #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR)  \
  913. { if (CONSTANT_ADDRESS_P (X)                        \
  914.       || (GET_CODE (X) == SYMBOL_REF)  \
  915.       || (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X))            \
  916.       || ((GET_CODE (X) == PRE_DEC || GET_CODE (X) == POST_INC)        \
  917.           && REG_P (XEXP (X, 0))                    \
  918.           && REG_OK_FOR_BASE_P (XEXP (X, 0)))                \
  919.       || (GET_CODE (X) == PLUS                        \
  920.           && REG_P (XEXP (X, 0)) && REG_OK_FOR_BASE_P (XEXP (X, 0))    \
  921.           && GET_CODE (XEXP (X, 1)) == CONST_INT            \
  922.           && ((unsigned) INTVAL (XEXP (X, 1)) + 0x8000) < 0x10000)) goto ADDR;\
  923.   GO_IF_INDEXING (X, ADDR);                        \
  924.   if (GET_CODE (X) == PLUS)                        \
  925.     { if (GET_CODE (XEXP (X, 1)) == CONST_INT                \
  926.           && (unsigned) INTVAL (XEXP (X, 1)) + 0x80 < 0x100)        \
  927.        { rtx go_temp = XEXP (X, 0); GO_IF_INDEXING (go_temp, ADDR); }  \
  928.       if (GET_CODE (XEXP (X, 0)) == CONST_INT                \
  929.       && (unsigned) INTVAL (XEXP (X, 0)) + 0x80 < 0x100)        \
  930.        { rtx go_temp = XEXP (X, 1); GO_IF_INDEXING (go_temp, ADDR); } } }
  931.  
  932. /* Try machine-dependent ways of modifying an illegitimate address
  933.    to be legitimate.  If we find one, return the new, valid address.
  934.    This macro is used in only one place: `memory_address' in explow.c.
  935.  
  936.    OLDX is the address as it was before break_out_memory_refs was called.
  937.    In some cases it is useful to look at this to decide what needs to be done.
  938.  
  939.    MODE and WIN are passed so that this macro can use
  940.    GO_IF_LEGITIMATE_ADDRESS.
  941.  
  942.    It is always safe for this macro to do nothing.  It exists to recognize
  943.    opportunities to optimize the output.
  944.  
  945.    For the 68000, we handle X+REG by loading X into a register R and
  946.    using R+REG.  R will go in an address reg and indexing will be used.
  947.    However, if REG is a broken-out memory address or multiplication,
  948.    nothing needs to be done because REG can certainly go in an address reg.  */
  949.  
  950. #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN)   \
  951. { register int ch = (X) != (OLDX);                    \
  952.   if (GET_CODE (X) == PLUS)                        \
  953.     { if (GET_CODE (XEXP (X, 0)) == MULT)                \
  954.     ch = 1, XEXP (X, 0) = force_operand (XEXP (X, 0), 0);        \
  955.       if (GET_CODE (XEXP (X, 1)) == MULT)                \
  956.     ch = 1, XEXP (X, 1) = force_operand (XEXP (X, 1), 0);        \
  957.       if (ch && GET_CODE (XEXP (X, 1)) == REG                \
  958.       && GET_CODE (XEXP (X, 0)) == REG)                \
  959.     return X;                            \
  960.       if (ch) { GO_IF_LEGITIMATE_ADDRESS (MODE, X, WIN); }        \
  961.       if (GET_CODE (XEXP (X, 0)) == REG                    \
  962.            || (GET_CODE (XEXP (X, 0)) == SIGN_EXTEND        \
  963.            && GET_CODE (XEXP (XEXP (X, 0), 0)) == REG        \
  964.            && GET_MODE (XEXP (XEXP (X, 0), 0)) == HImode))    \
  965.     { register rtx temp = gen_reg_rtx (Pmode);            \
  966.       register rtx val = force_operand (XEXP (X, 1), 0);        \
  967.       emit_move_insn (temp, val);                    \
  968.       XEXP (X, 1) = temp;                        \
  969.       return X; }                            \
  970.       else if (GET_CODE (XEXP (X, 1)) == REG                \
  971.            || (GET_CODE (XEXP (X, 1)) == SIGN_EXTEND        \
  972.            && GET_CODE (XEXP (XEXP (X, 1), 0)) == REG        \
  973.            && GET_MODE (XEXP (XEXP (X, 1), 0)) == HImode))    \
  974.     { register rtx temp = gen_reg_rtx (Pmode);            \
  975.       register rtx val = force_operand (XEXP (X, 0), 0);        \
  976.       emit_move_insn (temp, val);                    \
  977.       XEXP (X, 0) = temp;                        \
  978.       return X; }}}
  979.  
  980. /* Go to LABEL if ADDR (a legitimate address expression)
  981.    has an effect that depends on the machine mode it is used for.
  982.    On the 68000, only predecrement and postincrement address depend thus
  983.    (the amount of decrement or increment being the length of the operand).  */
  984.  
  985. #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL)    \
  986.  if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == PRE_DEC) goto LABEL
  987.  
  988. /* Specify the machine mode that this machine uses
  989.    for the index in the tablejump instruction.  */
  990. #define CASE_VECTOR_MODE HImode
  991.  
  992. /* Define this if the tablejump instruction expects the table
  993.    to contain offsets from the address of the table.
  994.    Do not define this if the table should contain absolute addresses.  */
  995. #define CASE_VECTOR_PC_RELATIVE
  996.  
  997. /* Specify the tree operation to be used to convert reals to integers.  */
  998. #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
  999.  
  1000. /* This is the kind of divide that is easiest to do in the general case.  */
  1001. #define EASY_DIV_EXPR TRUNC_DIV_EXPR
  1002.  
  1003. /* Define this as 1 if `char' should by default be signed; else as 0.  */
  1004. #define DEFAULT_SIGNED_CHAR 1
  1005.  
  1006. /* Max number of bytes we can move from memory to memory
  1007.    in one reasonably fast instruction.  */
  1008. #define MOVE_MAX 4
  1009.  
  1010. /* Define this if zero-extension is slow (more than one real instruction).  */
  1011. #define SLOW_ZERO_EXTEND
  1012.  
  1013. /* Nonzero if access to memory by bytes is slow and undesirable.  */
  1014. #define SLOW_BYTE_ACCESS 0
  1015.  
  1016. /* Define if shifts truncate the shift count
  1017.    which implies one can omit a sign-extension or zero-extension
  1018.    of a shift count.  */
  1019. #define SHIFT_COUNT_TRUNCATED
  1020.  
  1021. /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
  1022.    is done just by pretending it is already truncated.  */
  1023. #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
  1024.  
  1025. /* We assume that the store-condition-codes instructions store 0 for false
  1026.    and some other value for true.  This is the value stored for true.  */
  1027.  
  1028. #define STORE_FLAG_VALUE -1
  1029.  
  1030. /* When a prototype says `char' or `short', really pass an `int'.  */
  1031. /* This has to be selectively modified in the code, so as to accommodate
  1032.    Pascal functions that sometimes need only shorts to be passed. */
  1033.  
  1034. #define PROMOTE_PROTOTYPES
  1035.  
  1036. /* Specify the machine mode that pointers have.
  1037.    After generation of rtl, the compiler makes no further distinction
  1038.    between pointers and any other objects of this machine mode.  */
  1039. #define Pmode SImode
  1040.  
  1041. /* A function address in a call instruction
  1042.    is a byte address (for indexing purposes)
  1043.    so give the MEM rtx a byte's mode.  */
  1044. #define FUNCTION_MODE QImode
  1045.  
  1046. /* Compute the cost of computing a constant rtl expression RTX
  1047.    whose rtx-code is CODE.  The body of this macro is a portion
  1048.    of a switch statement.  If the code is computed here,
  1049.    return it with a return statement.  Otherwise, break from the switch.  */
  1050.  
  1051. #define CONST_COSTS(RTX,CODE) \
  1052.   case CONST_INT:                        \
  1053.     /* Constant zero is super cheap due to clr instruction.  */    \
  1054.     if (RTX == const0_rtx) return 0;                \
  1055.     if ((unsigned) INTVAL (RTX) < 077) return 1;        \
  1056.   case CONST:                            \
  1057.   case LABEL_REF:                        \
  1058.   case SYMBOL_REF:                        \
  1059.     return 3;                            \
  1060.   case CONST_DOUBLE:                        \
  1061.     return 5;
  1062.  
  1063.  
  1064. /* Tell final.c how to eliminate redundant test instructions.  */
  1065.  
  1066. /* Here we define machine-dependent flags and fields in cc_status
  1067.    (see `conditions.h').  */
  1068.  
  1069. /* Set if the cc value is actually in the 68881, so a floating point
  1070.    conditional branch must be output.  */
  1071. #define CC_IN_68881 04000
  1072.  
  1073. /* Store in cc_status the expressions
  1074.    that the condition codes will describe
  1075.    after execution of an instruction whose pattern is EXP.
  1076.    Do not alter them if the instruction would not alter the cc's.  */
  1077.  
  1078. /* On the 68000, all the insns to store in an address register
  1079.    fail to set the cc's.  However, in some cases these instructions
  1080.    can make it possibly invalid to use the saved cc's.  In those
  1081.    cases we clear out some or all of the saved cc's so they won't be used.  */
  1082.  
  1083. #define NOTICE_UPDATE_CC(EXP, INSN) \
  1084. {                                \
  1085.   if (GET_CODE (EXP) == SET)                \
  1086.     { if (ADDRESS_REG_P (SET_DEST (EXP)))            \
  1087.     { if (cc_status.value1                    \
  1088.           && reg_overlap_mentioned_p (SET_DEST (EXP), cc_status.value1)) \
  1089.         cc_status.value1 = 0;                \
  1090.       if (cc_status.value2                    \
  1091.           && reg_overlap_mentioned_p (SET_DEST (EXP), cc_status.value2)) \
  1092.         cc_status.value2 = 0; }                \
  1093.       else if (!FP_REG_P (SET_DEST (EXP))            \
  1094.            && SET_DEST (EXP) != cc0_rtx            \
  1095.            && (FP_REG_P (SET_SRC (EXP))            \
  1096.            || GET_CODE (SET_SRC (EXP)) == FIX        \
  1097.            || GET_CODE (SET_SRC (EXP)) == FLOAT_TRUNCATE \
  1098.            || GET_CODE (SET_SRC (EXP)) == FLOAT_EXTEND)) \
  1099.     { CC_STATUS_INIT; }                    \
  1100.       /* A pair of move insns doesn't produce a useful overall cc.  */ \
  1101.       else if (!FP_REG_P (SET_DEST (EXP))            \
  1102.            && !FP_REG_P (SET_SRC (EXP))            \
  1103.            && GET_MODE_SIZE (GET_MODE (SET_SRC (EXP))) > 4    \
  1104.            && (GET_CODE (SET_SRC (EXP)) == REG        \
  1105.            || GET_CODE (SET_SRC (EXP)) == MEM        \
  1106.            || GET_CODE (SET_SRC (EXP)) == CONST_DOUBLE)) \
  1107.     { CC_STATUS_INIT; }                    \
  1108.       else if (GET_CODE (SET_SRC (EXP)) == CALL)        \
  1109.     { CC_STATUS_INIT; }                    \
  1110.       else if (XEXP (EXP, 0) != pc_rtx)                \
  1111.     { cc_status.flags = 0;                    \
  1112.       cc_status.value1 = XEXP (EXP, 0);            \
  1113.       cc_status.value2 = XEXP (EXP, 1); } }            \
  1114.   else if (GET_CODE (EXP) == PARALLEL                \
  1115.        && GET_CODE (XVECEXP (EXP, 0, 0)) == SET)        \
  1116.     {                                \
  1117.       if (ADDRESS_REG_P (XEXP (XVECEXP (EXP, 0, 0), 0)))    \
  1118.     CC_STATUS_INIT;                        \
  1119.       else if (XEXP (XVECEXP (EXP, 0, 0), 0) != pc_rtx)        \
  1120.     { cc_status.flags = 0;                    \
  1121.       cc_status.value1 = XEXP (XVECEXP (EXP, 0, 0), 0);    \
  1122.       cc_status.value2 = XEXP (XVECEXP (EXP, 0, 0), 1); } }    \
  1123.   else CC_STATUS_INIT;                        \
  1124.   if (cc_status.value2 != 0                    \
  1125.       && ADDRESS_REG_P (cc_status.value2)            \
  1126.       && GET_MODE (cc_status.value2) == QImode)            \
  1127.     CC_STATUS_INIT;                        \
  1128.   if (cc_status.value1 && GET_CODE (cc_status.value1) == REG    \
  1129.       && cc_status.value2                    \
  1130.       && reg_overlap_mentioned_p (cc_status.value1, cc_status.value2))    \
  1131.     cc_status.value2 = 0;                    \
  1132.   if (((cc_status.value1 && FP_REG_P (cc_status.value1))    \
  1133.        || (cc_status.value2 && FP_REG_P (cc_status.value2)))    \
  1134.       && !((cc_status.value1 && 0)    \
  1135.        || (cc_status.value2 && 0)))  \
  1136.     cc_status.flags = CC_IN_68881; }
  1137.  
  1138. #define OUTPUT_JUMP(NORMAL, FLOAT, NO_OV)  \
  1139. { if (cc_prev_status.flags & CC_IN_68881)            \
  1140.     return FLOAT;                        \
  1141.   if (cc_prev_status.flags & CC_NO_OVERFLOW)            \
  1142.     return NO_OV;                        \
  1143.   return NORMAL; }
  1144.  
  1145. /* Control the assembler format that we output.  */
  1146.  
  1147. #define ASM_IDENTIFY_GCC(FILE)  \
  1148. { extern char *version_string;  \
  1149.   fprintf((FILE), "; Compiled by MPW GCC %s\n", version_string);  }
  1150.  
  1151. /* Dump out all sorts of random header stuff that MPW wants. */
  1152.  
  1153. #define ASM_FILE_START(FILE)    \
  1154. {  \
  1155.   ASM_SEGMENT_NAME(FILE, segment_name);  \
  1156.   if (TARGET_68020)  \
  1157.     fprintf (FILE, "\tMACHINE MC68020\n");  \
  1158.   if (!TARGET_68020)  \
  1159.     fprintf (FILE, "\tMACHINE MC68000\n");  \
  1160.   if (TARGET_68881)  \
  1161.     fprintf (FILE, "\tMC68881\n");  \
  1162.   if (TARGET_32BITDATA && TARGET_68020)  \
  1163.     fprintf (FILE, "\tFORWARD LONG\n");  \
  1164.   fprintf (FILE, "\tSTRING ASIS\n");  \
  1165.   fprintf (FILE, "\tCASE ON\n");  \
  1166. }
  1167.  
  1168. /* Output to assembler file text saying following lines
  1169.    may contain character constants, extra white space, comments, etc.  */
  1170.  
  1171. #define ASM_APP_ON "; begin asm code\n"
  1172.  
  1173. /* Output to assembler file text saying following lines
  1174.    no longer contain unusual constructs.  */
  1175.  
  1176. #define ASM_APP_OFF "; end asm code\n"
  1177.  
  1178. /* Output before read-only data.  */
  1179.  
  1180. #define TEXT_SECTION_ASM_OP "\tCODE"
  1181.  
  1182. /* Output before writable data.  */
  1183.  
  1184. #define DATA_SECTION_ASM_OP "\tDATA"
  1185.  
  1186. /* Force all data thingies and variables to be data, except for strings
  1187.    glued onto the end of function modules. */
  1188.  
  1189. #define SELECT_SECTION(DECL)  \
  1190.   if (TARGET_BSTR && (TREE_CODE (DECL) == STRING_CST) && current_function_decl)  \
  1191.     ;  \
  1192.   else  \
  1193.     data_section ();
  1194.  
  1195. #define SELECT_RTX_SECTION(MODE,X) data_section ()
  1196.  
  1197. /* The MPW proc declaration autoswitches to text section, so we need this
  1198.    to tell GCC that this has happened. */
  1199.  
  1200. #define EXTRA_SECTION_FUNCTIONS  \
  1201.   void force_text_section () { in_section = in_text; }
  1202.  
  1203. /* How to refer to registers in assembler output.
  1204.    This sequence is indexed by compiler's hard-register-number (see above).  */
  1205.  
  1206. #define REGISTER_NAMES \
  1207. {"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",    \
  1208.  "a0", "a1", "a2", "a3", "a4", "a5", "a6", "sp",    \
  1209.  "fp0", "fp1", "fp2", "fp3", "fp4", "fp5", "fp6", "fp7", }
  1210.  
  1211. /* How to renumber registers for dbx and gdb. Not used... */
  1212.  
  1213. #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
  1214.  
  1215. /* Note that PROC in MPW asm automatically declares CODE, so we
  1216.    have to change the assumed section without writing the directive. */
  1217.  
  1218. #define ASM_PREDECLARE_FUNCTION_NAME(FILE,NAME,DECL)  \
  1219. {  \
  1220.   assemble_name (FILE, NAME);  \
  1221.   fprintf (FILE, "%% \tPROC\n");  \
  1222.   force_text_section ();  \
  1223.   import_undefined (FILE);  \
  1224.   text_section();  \
  1225. }
  1226.  
  1227. #define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL)  \
  1228. {  \
  1229.   if (TARGET_FX30)  \
  1230.     fprintf (FILE, "\tIMPORT _StaticDataArea\n");  \
  1231.   if ((DECL) && TREE_PUBLIC (DECL))   \
  1232.     fprintf (FILE, "\tEXPORT ");  \
  1233.   else  \
  1234.     fprintf (FILE, "\tENTRY ");  \
  1235.   assemble_name (FILE, NAME);  \
  1236.   fprintf (FILE, "\n");  \
  1237.   ASM_OUTPUT_LABEL (FILE, NAME);  \
  1238. }
  1239. /*
  1240.   fprintf (FILE, "%s \tPROC\n", (strcmp(NAME, "1main") == 0 ? "%" : "");  \
  1241. */
  1242.  
  1243. #define ASM_DECLARE_VARIABLE_NAME(FILE,NAME,PUBLIC)  \
  1244. {  \
  1245.   assemble_name (FILE, NAME);  \
  1246.   fprintf (FILE, "%% \tPROC\n");  \
  1247.   force_text_section ();  \
  1248.   import_undefined (FILE);  \
  1249.   data_section ();  \
  1250.   if (PUBLIC)   \
  1251.     fprintf (FILE, "\tEXPORT ");  \
  1252.   else  \
  1253.     fprintf (FILE, "\tENTRY ");  \
  1254.   assemble_name (FILE, NAME);  \
  1255.   fprintf (FILE, "\n");  \
  1256. /*  ASM_OUTPUT_LABEL (FILE, NAME); */  \
  1257. }
  1258.  
  1259. #define ASM_DECLARE_CONSTANT_NAME(FILE,NUM,EXP)  \
  1260. {  char label[256];\
  1261.   ASM_GENERATE_INTERNAL_LABEL (label, "LC", NUM);  \
  1262.   if (TARGET_BSTR && TREE_CODE(EXP) == STRING_CST && current_function_decl)  \
  1263.     {  \
  1264.     }  \
  1265.   else  \
  1266.     {  \
  1267.       assemble_name (FILE, label);  \
  1268.       fprintf (FILE, "%% \tPROC\n");  \
  1269.       force_text_section ();  \
  1270.     }  \
  1271. }
  1272.  
  1273. #define ASM_ENTRY_CONSTANT_NAME(FILE,NUM,EXP)  \
  1274. {  char label[256];\
  1275.   ASM_GENERATE_INTERNAL_LABEL (label, "LC", NUM);  \
  1276.   if (TARGET_BSTR && TREE_CODE(EXP) == STRING_CST && current_function_decl)  \
  1277.     {  \
  1278.     }  \
  1279.   else  \
  1280.     {  \
  1281.       fprintf (FILE, "\tENTRY ");  \
  1282.       assemble_name (FILE, label);  \
  1283.       fprintf (FILE, "\n");  \
  1284.     }  \
  1285. }
  1286.  
  1287. #define OUTPUT_LABELED_CONSTANT(asm_out_file,const_labelno,exp)  \
  1288.   if (! (TARGET_BSTR  && TREE_CODE (exp) == STRING_CST && current_function_decl)) {  \
  1289.     ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "LC", const_labelno);  \
  1290.     output_constant (exp,  \
  1291.            (TREE_CODE (exp) == STRING_CST  \
  1292.             ? TREE_STRING_LENGTH (exp)  \
  1293.             : int_size_in_bytes (TREE_TYPE (exp))));  \
  1294.   }
  1295.  
  1296. #define REMEMBER_CONSTANT_LABEL(lbl,exp)  \
  1297.   if (TARGET_BSTR  && TREE_CODE (exp) == STRING_CST && current_function_decl) \
  1298.     {  \
  1299.       ASM_FUNCTIONIFY_NAME (lbl);  \
  1300.       record_a_string (lbl, TREE_STRING_POINTER (exp));  \
  1301.       }
  1302.  
  1303. /* Exportation is done by general declaration macros. */
  1304.  
  1305. #define ASM_GLOBALIZE_LABEL(FILE,NAME)
  1306.  
  1307. #define ASM_OUTPUT_EXTERNAL(FILE,DECL,NAME)  \
  1308.   import_a_declared_name(DECL);
  1309.  
  1310. /* This is how to output the definition of a user-level label named NAME,
  1311.    such as the label on a static function or variable NAME.  */
  1312.  
  1313. #define ASM_OUTPUT_LABEL(FILE,NAME)    \
  1314. { assemble_name (FILE, NAME); fputs (":\n", FILE); }
  1315.  
  1316. /* This is how to output a reference to a user-level label named NAME.
  1317.    `assemble_name' uses this.  */
  1318.  
  1319. /* User-level labels (almost) always have one extra character that should
  1320.    be ignored.  They may also conflict with MPW Asm register names. */
  1321.  
  1322. #define ASM_OUTPUT_LABELREF(FILE,NAME)  \
  1323. {  \
  1324.   extern char *avoid_mpw_register_name();  \
  1325.   char *tname = avoid_mpw_register_name (NAME);  \
  1326.   if ('0' <= tname[0] && tname[0] <= '9')  \
  1327.    fprintf (FILE, "%s", tname+1);  \
  1328.   else  \
  1329.    fprintf (FILE, "%s", tname);  \
  1330. }
  1331.  
  1332. /* This is how to output an internal numbered label where
  1333.    PREFIX is the class of label and NUM is the number within the class.  */
  1334.  
  1335. #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM)    \
  1336.   fprintf (FILE, "%s#%d:\n", PREFIX, NUM)
  1337.  
  1338. /* This is how to store into the string LABEL
  1339.    the symbol_ref name of an internal numbered label where
  1340.    PREFIX is the class of label and NUM is the number within the class.
  1341.    This is suitable for output with `assemble_name'.  */
  1342.  
  1343. #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM)    \
  1344.   sprintf (LABEL, "2%s#%d", PREFIX, NUM)
  1345.  
  1346. /* This is how to output an assembler line defining a `float' constant.  */
  1347.  
  1348. #define ASM_OUTPUT_FLOAT(FILE,VALUE)  \
  1349.   fprintf (FILE, "\tDC.S \"%.9g\"\n", (VALUE))
  1350.  
  1351. #define ASM_OUTPUT_DOUBLE(FILE,VALUE)  \
  1352.   fprintf (FILE, "\tDC.D \"%.20g\"\n", (VALUE))
  1353.  
  1354. #define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE)  \
  1355.   output_mpw_long_double (FILE, VALUE)
  1356.  
  1357. /* This is how to output an assembler line defining an `int' constant.  */
  1358.  
  1359. #define ASM_OUTPUT_INT(FILE,VALUE)  \
  1360. ( fprintf (FILE, "\tDC.L "),            \
  1361.   output_addr_const (FILE, (VALUE)),        \
  1362.   fprintf (FILE, "\n"))
  1363.  
  1364. /* Likewise for `char' and `short' constants.  */
  1365.  
  1366. #define ASM_OUTPUT_SHORT(FILE,VALUE)  \
  1367. ( fprintf (FILE, "\tDC.W "),            \
  1368.   output_addr_const (FILE, (VALUE)),        \
  1369.   fprintf (FILE, "\n"))
  1370.  
  1371. #define ASM_OUTPUT_CHAR(FILE,VALUE)  \
  1372. ( fprintf (FILE, "\tDC.B "),            \
  1373.   output_addr_const (FILE, (VALUE)),        \
  1374.   fprintf (FILE, "\n"))
  1375.  
  1376. /* This is how to output an assembler line for a numeric constant byte.  */
  1377.  
  1378. #define ASM_OUTPUT_BYTE(FILE,VALUE)  \
  1379.   fprintf (FILE, "\tDC.B $%x\n", (VALUE))
  1380.  
  1381. /* This is how to output an insn to push a register on the stack.
  1382.    It need not be very fast code.  */
  1383.  
  1384. #define ASM_OUTPUT_REG_PUSH(FILE,REGNO)  \
  1385.   fprintf (FILE, "\tmove.l %s,-(sp)\n", reg_names[REGNO])
  1386.  
  1387. /* This is how to output an insn to pop a register from the stack.
  1388.    It need not be very fast code.  */
  1389.  
  1390. #define ASM_OUTPUT_REG_POP(FILE,REGNO)  \
  1391.   fprintf (FILE, "\tmove.l (sp)+,%s\n", reg_names[REGNO])
  1392.  
  1393. /* This is how to output an element of a case-vector that is absolute.
  1394.    (The 68000 does not use such vectors,
  1395.    but we must define this macro anyway.)  */
  1396.  
  1397. #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE)  \
  1398.   fprintf (FILE, "\tDC.L L#%d\n", VALUE)
  1399.  
  1400. /* This is how to output an element of a case-vector that is relative.  */
  1401.  
  1402. #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL)  \
  1403.   fprintf (FILE, "\tDC.W L#%d-L#%d\n", VALUE, REL)
  1404.  
  1405. /* This is how to output an assembler line
  1406.    that says to advance the location counter
  1407.    to a multiple of 2**LOG bytes.  */
  1408.  
  1409. #define ASM_OUTPUT_ALIGN(FILE,LOG)      \
  1410.   if ((LOG) == 1)            \
  1411.     fprintf (FILE, "\tALIGN 2\n");    \
  1412.   else if ((LOG) != 0)            \
  1413.     abort ();
  1414.  
  1415. /* A "skip" in MPW is better done by filling with zeros. */
  1416.  
  1417. #define ASM_OUTPUT_SKIP(FILE,SIZE)  \
  1418.   fprintf (FILE, "\tDCB.B %d,0\n", (SIZE))
  1419.  
  1420. /* This says how to output an assembler line
  1421.    to define a global common symbol.  */
  1422.  
  1423. #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED)  \
  1424. do {  \
  1425.   assemble_name (FILE, NAME);  \
  1426.   fprintf (FILE, "%% \tPROC\n");  \
  1427.   force_text_section ();  \
  1428.   data_section ();  \
  1429.   fprintf (FILE, "\tEXPORT ");  \
  1430.   assemble_name (FILE, NAME);  \
  1431.   fprintf (FILE, "\n");  \
  1432.   assemble_name (FILE, NAME);  \
  1433.   fprintf (FILE, ":\tDS.B %d\n", ROUNDED);  \
  1434.   fprintf (FILE, "\tENDP\t; ");  \
  1435.   assemble_name (FILE, NAME);  \
  1436.   fprintf (FILE, "\n");  \
  1437. } while (0)
  1438.  
  1439. /* This says how to output an assembler line
  1440.    to define a local common symbol.  */
  1441.  
  1442. #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED)  \
  1443. do {  \
  1444.   assemble_name (FILE, NAME);  \
  1445.   fprintf (FILE, "%% \tPROC\n");  \
  1446.   force_text_section ();  \
  1447.   data_section ();  \
  1448.   fprintf (FILE, "\tENTRY ");  \
  1449.   assemble_name (FILE, NAME);  \
  1450.   fprintf (FILE, "\n");  \
  1451.   assemble_name (FILE, NAME);  \
  1452.   fprintf (FILE, ":\tDS.B %d\n", ROUNDED);  \
  1453.   fprintf (FILE, "\tENDP\t; ");  \
  1454.   assemble_name (FILE, NAME);  \
  1455.   fprintf (FILE, "\n");  \
  1456. } while (0)
  1457.  
  1458. /* Store in OUTPUT a string (made with alloca) containing
  1459.    an assembler-name for a local static variable named NAME.
  1460.    LABELNO is an integer which is different for each call.  */
  1461.  
  1462. #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO)    \
  1463. ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 12),    \
  1464.   sprintf ((OUTPUT), "%s___%d", (NAME), (LABELNO)))
  1465.  
  1466. /* Modify symbol names to say what sort they are.  These can be destructive
  1467.    to the name string since they are supposed to be permanent. */
  1468.  
  1469. #define ASM_FUNCTIONIFY_NAME(NAME)  ((NAME)[0] = '1')
  1470.  
  1471. #define ASM_DATIFY_NAME(NAME)  ((NAME)[0] = '2')
  1472.  
  1473. /* Define the parentheses used to group arithmetic operations
  1474.    in assembler code.  */
  1475.  
  1476. #define ASM_OPEN_PAREN "("
  1477. #define ASM_CLOSE_PAREN ")"
  1478.  
  1479. /* Define results of standard character escape sequences.  */
  1480. #define TARGET_BELL 007
  1481. #define TARGET_BS 010
  1482. #define TARGET_TAB 011
  1483. #define TARGET_NEWLINE 13
  1484. #define TARGET_VT 013
  1485. #define TARGET_FF 014
  1486. #define TARGET_CR 10
  1487.  
  1488. /* Print operand X (an rtx) in assembler syntax to file FILE.
  1489.    CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
  1490.    For `%' followed by punctuation, CODE is the punctuation and X is null.
  1491.  
  1492.    On the 68000, we use several CODE characters:
  1493.    '#' for an immediate operand prefix.
  1494.  
  1495.    'b' for byte insn (no effect, on the Sun; this is for the ISI).
  1496.    'd' to force memory addressing to be absolute, not relative.
  1497. */
  1498.  
  1499. #define PRINT_OPERAND_PUNCT_VALID_P(CODE)                \
  1500.   ((CODE) == '#')
  1501.  
  1502. /* Note absence of float operands - they are always referred to by address
  1503.    and never appear directly in instructions (is this good?). */
  1504.  
  1505. #define PRINT_OPERAND(FILE, X, CODE)  \
  1506. { if (GET_CODE (X) == REG)                        \
  1507.     fprintf (FILE, "%s", reg_names[REGNO (X)]);                \
  1508.   else if (GET_CODE (X) == MEM)                        \
  1509.     output_address (XEXP (X, 0));                    \
  1510.   else if (CODE == 'b')  \
  1511.     output_addr_const (FILE, X);  \
  1512.   else if (GET_CODE (X) == CONST_DOUBLE)  \
  1513.     {  \
  1514.       putc ('#', FILE);  \
  1515.       if (CODE == 'f')  \
  1516.     output_mpw_float_as_int (FILE, X);  \
  1517.       else  \
  1518.     output_mpw_float (FILE, X);  \
  1519.     }  \
  1520.   else { putc ('#', FILE); output_addr_const (FILE, X); }}
  1521.  
  1522. #define PRINT_OPERAND_ADDRESS(FILE, ADDR)  \
  1523. { register rtx reg1, reg2, breg, ireg;                    \
  1524.   register rtx addr = ADDR;                        \
  1525.   rtx offset;                                \
  1526.   switch (GET_CODE (addr))                        \
  1527.     {                                    \
  1528.     case REG:                                \
  1529.       fprintf (FILE, "(%s)", reg_names[REGNO (addr)]);            \
  1530.       break;                                \
  1531.     case PRE_DEC:                            \
  1532.       fprintf (FILE, "-(%s)", reg_names[REGNO (XEXP (addr, 0))]);    \
  1533.       break;                                \
  1534.     case POST_INC:                            \
  1535.       fprintf (FILE, "(%s)+", reg_names[REGNO (XEXP (addr, 0))]);    \
  1536.       break;                                \
  1537.     case PLUS:                                \
  1538.       reg1 = 0;    reg2 = 0;                        \
  1539.       ireg = 0;    breg = 0;                        \
  1540.       offset = 0;                            \
  1541.       if (CONSTANT_ADDRESS_P (XEXP (addr, 0)))                \
  1542.     {                                \
  1543.       offset = XEXP (addr, 0);                    \
  1544.       addr = XEXP (addr, 1);                    \
  1545.     }                                \
  1546.       else if (CONSTANT_ADDRESS_P (XEXP (addr, 1)))            \
  1547.     {                                \
  1548.       offset = XEXP (addr, 1);                    \
  1549.       addr = XEXP (addr, 0);                    \
  1550.     }                                \
  1551.       if (GET_CODE (addr) != PLUS) ;                    \
  1552.       else if (GET_CODE (XEXP (addr, 0)) == SIGN_EXTEND)        \
  1553.     {                                \
  1554.       reg1 = XEXP (addr, 0);                    \
  1555.       addr = XEXP (addr, 1);                    \
  1556.     }                                \
  1557.       else if (GET_CODE (XEXP (addr, 1)) == SIGN_EXTEND)        \
  1558.     {                                \
  1559.       reg1 = XEXP (addr, 1);                    \
  1560.       addr = XEXP (addr, 0);                    \
  1561.     }                                \
  1562.       else if (GET_CODE (XEXP (addr, 0)) == MULT)            \
  1563.     {                                \
  1564.       reg1 = XEXP (addr, 0);                    \
  1565.       addr = XEXP (addr, 1);                    \
  1566.     }                                \
  1567.       else if (GET_CODE (XEXP (addr, 1)) == MULT)            \
  1568.     {                                \
  1569.       reg1 = XEXP (addr, 1);                    \
  1570.       addr = XEXP (addr, 0);                    \
  1571.     }                                \
  1572.       else if (GET_CODE (XEXP (addr, 0)) == REG)            \
  1573.     {                                \
  1574.       reg1 = XEXP (addr, 0);                    \
  1575.       addr = XEXP (addr, 1);                    \
  1576.     }                                \
  1577.       else if (GET_CODE (XEXP (addr, 1)) == REG)            \
  1578.     {                                \
  1579.       reg1 = XEXP (addr, 1);                    \
  1580.       addr = XEXP (addr, 0);                    \
  1581.     }                                \
  1582.       if (GET_CODE (addr) == REG || GET_CODE (addr) == MULT        \
  1583.       || GET_CODE (addr) == SIGN_EXTEND)                \
  1584.     { if (reg1 == 0) reg1 = addr; else reg2 = addr; addr = 0; }    \
  1585.       if (offset != 0) { if (addr != 0) abort (); addr = offset; }    \
  1586.       if ((reg1 && (GET_CODE (reg1) == SIGN_EXTEND            \
  1587.             || GET_CODE (reg1) == MULT))            \
  1588.       || (reg2 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg2))))        \
  1589.     { breg = reg2; ireg = reg1; }                    \
  1590.       else if (reg1 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg1)))        \
  1591.     { breg = reg1; ireg = reg2; }                    \
  1592.       if (ireg != 0 && breg == 0 && GET_CODE (addr) == LABEL_REF)    \
  1593.         { int scale = 1;                        \
  1594.       if (GET_CODE (ireg) == MULT)                    \
  1595.         { scale = INTVAL (XEXP (ireg, 1));                \
  1596.           ireg = XEXP (ireg, 0); }                    \
  1597.       if (GET_CODE (ireg) == SIGN_EXTEND)                \
  1598.         fprintf (FILE, "L#%d(pc,%s.w",            \
  1599.              CODE_LABEL_NUMBER (XEXP (addr, 0)),        \
  1600.              reg_names[REGNO (XEXP (ireg, 0))]);         \
  1601.       else                                \
  1602.         fprintf (FILE, "L#%d(pc,%s.l",            \
  1603.              CODE_LABEL_NUMBER (XEXP (addr, 0)),        \
  1604.              reg_names[REGNO (ireg)]);                \
  1605.       if (scale != 1) fprintf (FILE, "*%d", scale);            \
  1606.       putc (')', FILE);                        \
  1607.       break; }                            \
  1608.       if (ireg != 0 || breg != 0)                    \
  1609.     { int scale = 1;                        \
  1610.       if (breg == 0)                        \
  1611.         abort ();                            \
  1612.       if (addr != 0)                        \
  1613.         output_addr_const (FILE, addr);                \
  1614.       fprintf (FILE, "(%s", reg_names[REGNO (breg)]);        \
  1615.       if (ireg != 0)                        \
  1616.         putc (',', FILE);                        \
  1617.       if (ireg != 0 && GET_CODE (ireg) == MULT)            \
  1618.         { scale = INTVAL (XEXP (ireg, 1));                \
  1619.           ireg = XEXP (ireg, 0); }                    \
  1620.       if (ireg != 0 && GET_CODE (ireg) == SIGN_EXTEND)        \
  1621.         fprintf (FILE, "%s.w", reg_names[REGNO (XEXP (ireg, 0))]);    \
  1622.       else if (ireg != 0)                        \
  1623.         fprintf (FILE, "%s.l", reg_names[REGNO (ireg)]);        \
  1624.       if (scale != 1) fprintf (FILE, "*%d", scale);            \
  1625.       putc (')', FILE);                        \
  1626.       break;                            \
  1627.     }                                \
  1628.       else if (reg1 != 0 && GET_CODE (addr) == LABEL_REF)        \
  1629.     { fprintf (FILE, "L#%d(pc,%s.w)",            \
  1630.            CODE_LABEL_NUMBER (XEXP (addr, 0)),            \
  1631.            reg_names[REGNO (reg1)]);                \
  1632.       break; }                            \
  1633.     default:                                \
  1634.       if (GET_CODE (addr) == CONST_INT                    \
  1635.       && INTVAL (addr) < 0x8000                    \
  1636.       && INTVAL (addr) >= -0x8000)                    \
  1637.     fprintf (FILE, "%d", INTVAL (addr));                \
  1638.       else if (TARGET_32BITDATA && global_data_ref_p (addr))  \
  1639.     {  \
  1640.       fprintf (FILE, "(");  \
  1641.       output_addr_const (FILE, addr);            \
  1642.       fprintf (FILE, ",a5)");  \
  1643.     }  \
  1644.       else  \
  1645.         output_addr_const (FILE, addr);                \
  1646.     }  \
  1647. }
  1648.  
  1649. /* No library stuff, MPW compilers never invoke the linker themselves. */
  1650.  
  1651. #define ASM_OUTPUT_ASCII(FILE,STRING,SIZE)  \
  1652.   output_mpw_string(FILE, STRING, SIZE);
  1653.  
  1654. /* At the end of a function module, prepare for the next module. */
  1655.  
  1656. #define ASM_FUNCTION_END(FILE) \
  1657. {  extern char *current_function_name; \
  1658.    fprintf (FILE, "\tENDP\t; %s\n", current_function_name);  \
  1659. }
  1660.  
  1661. /* At the end of a variable module, prepare for the next module. */
  1662.  
  1663. #define ASM_VARIABLE_END(FILE,NAME) \
  1664. {  \
  1665.    fprintf (FILE, "\tENDP\t; ");  \
  1666.    assemble_name (FILE, NAME);  \
  1667.    fprintf (FILE, "\n");  \
  1668. }
  1669.  
  1670. /* At the end of a variable module, prepare for the next module. */
  1671.  
  1672. #define ASM_CONSTANT_END(FILE,NUM,EXP) \
  1673. {  \
  1674.   if (TARGET_BSTR && TREE_CODE(EXP) == STRING_CST && current_function_decl)  \
  1675.     {  \
  1676.     }  \
  1677.   else  \
  1678.     {  \
  1679.       fprintf (FILE, "\tENDP\n");  \
  1680.     }  \
  1681. }
  1682.  
  1683. /* Write out a segment name. */
  1684.  
  1685. #define ASM_SEGMENT_NAME(FILE,NAME)  \
  1686.   if (! TARGET_NOSEG) fprintf(FILE, "\tSEG '%s'\n", NAME);
  1687.  
  1688. /* Write out an import of a name not in this module. */
  1689.  
  1690. #define ASM_IMPORT_NAME(FILE, NAME)  \
  1691. { \
  1692.   (((NAME)[0] == '2') ? data_section () : text_section ());  \
  1693.   fprintf (FILE, "\tIMPORT ");  \
  1694.   assemble_name (FILE, NAME);  \
  1695.   fprintf (file, "\n");  \
  1696. }
  1697.  
  1698. /* At the end of the whole file, spit out a last directive. */
  1699.  
  1700. #define ASM_FILE_END(FILE) \
  1701.   fprintf(FILE, "\tEND\n");
  1702.  
  1703. /* Magic for the handling of 10/12 byte long doubles. */
  1704.  
  1705. #ifdef MPW
  1706. #define REAL_VALUE_TYPE extended
  1707. #else
  1708.  
  1709. /* Don't bother to try to do anything special.  Default will be to use
  1710.    'double', which is adequate except for trying to cross-compile extended
  1711.    float constants on a machine that doesn't support them, which I don't
  1712.    want to bother with right now.  Note that cross-compilation of vars,
  1713.    arith, etc, is still ok - only constants might be wrong. */
  1714.  
  1715. #endif
  1716.  
  1717. /* Machinery to add math-oriented builtin functions. */
  1718.  
  1719. #define ADDITIONAL_BUILTIN_SYMS  \
  1720.   BUILT_IN_SIN,  \
  1721.   BUILT_IN_COS,  \
  1722.   BUILT_IN_TAN,  \
  1723.   BUILT_IN_ASIN,  \
  1724.   BUILT_IN_ACOS,  \
  1725.   BUILT_IN_ATAN,  \
  1726.   BUILT_IN_SINH,  \
  1727.   BUILT_IN_COSH,  \
  1728.   BUILT_IN_TANH,  \
  1729.   BUILT_IN_EXP,  \
  1730.   BUILT_IN_LOG,  \
  1731.   BUILT_IN_LOG10,  \
  1732.   BUILT_IN_SQRT,
  1733.  
  1734. #define ADDITIONAL_BUILTINS  \
  1735.   if (TARGET_ELEMS881)  \
  1736.     {  \
  1737.       builtin_function ("cos", extended_ftype_extended, BUILT_IN_COS);  \
  1738.       builtin_function ("sin", extended_ftype_extended, BUILT_IN_SIN);  \
  1739.       builtin_function ("tan", extended_ftype_extended, BUILT_IN_TAN);  \
  1740.       builtin_function ("asin", extended_ftype_extended, BUILT_IN_ASIN);  \
  1741.       builtin_function ("acos", extended_ftype_extended, BUILT_IN_ACOS);  \
  1742.       builtin_function ("atan", extended_ftype_extended, BUILT_IN_ATAN);  \
  1743.       builtin_function ("sinh", extended_ftype_extended, BUILT_IN_SINH);  \
  1744.       builtin_function ("cosh", extended_ftype_extended, BUILT_IN_COSH);  \
  1745.       builtin_function ("tanh", extended_ftype_extended, BUILT_IN_TANH);  \
  1746.       builtin_function ("exp", extended_ftype_extended, BUILT_IN_EXP);  \
  1747.       builtin_function ("log", extended_ftype_extended, BUILT_IN_LOG);  \
  1748.       builtin_function ("log10", extended_ftype_extended, BUILT_IN_LOG10);  \
  1749.       builtin_function ("sqrt", extended_ftype_extended, BUILT_IN_SQRT);  \
  1750.     }
  1751.  
  1752. /* A big chunk of code for expression expansion. */
  1753. /* Note:  We are passing XFmode rather than mode to expand_unop.  This is
  1754.    a hack as mode equals VOIDmode when this is called and it should equal
  1755.    XFmode.  This change should be fairly safe as we know that these functions
  1756.    use XFmode only.  This worked with all the test cases we could find.  */
  1757. #define ADDITIONAL_EXPAND_BUILTIN  \
  1758.     case BUILT_IN_SIN:  \
  1759.       op0 = expand_expr (TREE_VALUE (arglist), subtarget, VOIDmode, 0);  \
  1760.       target = expand_unop (XFmode, sin_optab, op0, target, 1);  \
  1761.       if (target == 0) abort ();  \
  1762.       return target;  \
  1763.     case BUILT_IN_COS:  \
  1764.       op0 = expand_expr (TREE_VALUE (arglist), subtarget, VOIDmode, 0);  \
  1765.       target = expand_unop (XFmode, cos_optab, op0, target, 1);  \
  1766.       if (target == 0) abort ();  \
  1767.       return target;  \
  1768.     case BUILT_IN_TAN:  \
  1769.       op0 = expand_expr (TREE_VALUE (arglist), subtarget, VOIDmode, 0);  \
  1770.       target = expand_unop (XFmode, tan_optab, op0, target, 1);  \
  1771.       if (target == 0) abort ();  \
  1772.       return target;  \
  1773.     case BUILT_IN_ASIN:  \
  1774.       op0 = expand_expr (TREE_VALUE (arglist), subtarget, VOIDmode, 0);  \
  1775.       target = expand_unop (XFmode, asin_optab, op0, target, 1);  \
  1776.       if (target == 0) abort ();  \
  1777.       return target;  \
  1778.     case BUILT_IN_ACOS:  \
  1779.       op0 = expand_expr (TREE_VALUE (arglist), subtarget, VOIDmode, 0);  \
  1780.       target = expand_unop (XFmode, acos_optab, op0, target, 1);  \
  1781.       if (target == 0) abort ();  \
  1782.       return target;  \
  1783.     case BUILT_IN_ATAN:  \
  1784.       op0 = expand_expr (TREE_VALUE (arglist), subtarget, VOIDmode, 0);  \
  1785.       target = expand_unop (XFmode, atan_optab, op0, target, 1);  \
  1786.       if (target == 0) abort ();  \
  1787.       return target;  \
  1788.     case BUILT_IN_SINH:  \
  1789.       op0 = expand_expr (TREE_VALUE (arglist), subtarget, VOIDmode, 0);  \
  1790.       target = expand_unop (XFmode, sinh_optab, op0, target, 1);  \
  1791.       if (target == 0) abort ();  \
  1792.       return target;  \
  1793.     case BUILT_IN_COSH:  \
  1794.       op0 = expand_expr (TREE_VALUE (arglist), subtarget, VOIDmode, 0);  \
  1795.       target = expand_unop (XFmode, cosh_optab, op0, target, 1);  \
  1796.       if (target == 0) abort ();  \
  1797.       return target;  \
  1798.     case BUILT_IN_TANH:  \
  1799.       op0 = expand_expr (TREE_VALUE (arglist), subtarget, VOIDmode, 0);  \
  1800.       target = expand_unop (XFmode, tanh_optab, op0, target, 1);  \
  1801.       if (target == 0) abort ();  \
  1802.       return target;  \
  1803.     case BUILT_IN_EXP:  \
  1804.       op0 = expand_expr (TREE_VALUE (arglist), subtarget, VOIDmode, 0);  \
  1805.       target = expand_unop (XFmode, exp_optab, op0, target, 1);  \
  1806.       if (target == 0) abort ();  \
  1807.       return target;  \
  1808.     case BUILT_IN_LOG:  \
  1809.       op0 = expand_expr (TREE_VALUE (arglist), subtarget, VOIDmode, 0);  \
  1810.       target = expand_unop (XFmode, log_optab, op0, target, 1);  \
  1811.       if (target == 0) abort ();  \
  1812.       return target;  \
  1813.     case BUILT_IN_LOG10:  \
  1814.       op0 = expand_expr (TREE_VALUE (arglist), subtarget, VOIDmode, 0);  \
  1815.       target = expand_unop (XFmode, log10_optab, op0, target, 1);  \
  1816.       if (target == 0) abort ();  \
  1817.       return target;  \
  1818.     case BUILT_IN_SQRT:  \
  1819.       op0 = expand_expr (TREE_VALUE (arglist), subtarget, VOIDmode, 0);  \
  1820.       target = expand_unop (XFmode, sqrt_optab, op0, target, 1);  \
  1821.       if (target == 0) abort ();  \
  1822.       return target;  \
  1823.